package com.shrio.test.commom;

/**
 * Created by joychen on 2017/11/7 下午12:50 .
 * version 1.0.0
 */
public class AssertThowUtil {

    public static String throwNotBlank(String message,String target) {
        if (target == null || (target = target.trim()).length() == 0) {
            throw new ThisSystemException(message);
        }
        return target;
    }
    public static String $(String message,String target){
       return throwNotBlank(message,target);
    }

    /**
     *
     * @param message
     * @param o
     */
    public static void assertNotNull(String message,Object o){
        if (o == null){
            throw  new ThisSystemException(message);
        }
    }

    /**
     *
     * @param message
     * @param o
     */
    public static void assertIsNull(String message,Object o){
        if (o != null){
            throw  new ThisSystemException(message);
        }
    }

    public static void assertEquals(String message,Object a,Object b){
        if (a == null?a == b:a.equals(b)){
            throw new ThisSystemException(message);
        }
    }

    public static void assertNotEquals(String message,Object a,Object b){
        if (a == null?a != b:!a.equals(b)){
            throw new ThisSystemException(message);
        }
    }
}
